using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Transform Field</para>
    /// <para>Transforms continuous values in one or more fields by applying mathematical functions to each value and
    /// changing the shape of the distribution. The transformation methods
    /// in the tool include log, square root, Box-Cox, multiplicative
    /// inverse, square, exponential, and inverse Box-Cox.</para>
    /// <para>通过对每个值应用数学函数来转换一个或多个字段中的连续值，并且
    /// 更改分布的形状。转换方法
    /// 在工具中包括对数、平方根、Box-Cox、乘法
    /// 反、平方、指数和反 Box-Cox。</para>
    /// </summary>    
    [DisplayName("Transform Field")]
    public class TransformField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TransformField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The input table or feature class containing the fields to be transformed. The newly transformed fields are added to the input table.</para>
        /// <para>包含要变换的字段的输入表或要素类。新转换的字段将添加到输入表中。</para>
        /// </param>
        /// <param name="_fields">
        /// <para>Field to Transform</para>
        /// <para>The fields containing the values to be transformed. For each field, an output field name can be specified. If an output field name is not provided, the tool creates an output field name using the field name and transformation method.</para>
        /// <para>包含要转换的值的字段。对于每个字段，可以指定输出字段名称。如果未提供输出字段名称，则该工具将使用字段名称和变换方法创建输出字段名称。</para>
        /// </param>
        public TransformField(object _in_table, object _fields)
        {
            this._in_table = _in_table;
            this._fields = _fields;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Transform Field";

        public override string CallName => "management.TransformField";

        public override List<string> AcceptEnvironments => ["extent"];

        public override object[] ParameterInfo => [_in_table, _fields, _method.GetGPValue(), _power, _shift, _updated_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The input table or feature class containing the fields to be transformed. The newly transformed fields are added to the input table.</para>
        /// <para>包含要变换的字段的输入表或要素类。新转换的字段将添加到输入表中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Field to Transform</para>
        /// <para>The fields containing the values to be transformed. For each field, an output field name can be specified. If an output field name is not provided, the tool creates an output field name using the field name and transformation method.</para>
        /// <para>包含要转换的值的字段。对于每个字段，可以指定输出字段名称。如果未提供输出字段名称，则该工具将使用字段名称和变换方法创建输出字段名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field to Transform")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _fields { get; set; }


        /// <summary>
        /// <para>Transformation Method</para>
        /// <para><xdoc>
        ///   <para>Specifies the method that is used to transform the values contained in the specified fields.</para>
        ///   <bulletList>
        ///     <bullet_item>Multiplicative Inverse—The multiplicative inverse (1/x) method is applied to the original value (x) in the selected fields.</bullet_item><para/>
        ///     <bullet_item>Square root—The square root method is applied to the original value in the selected fields.</bullet_item><para/>
        ///     <bullet_item>Log—The natural logarithmic function, log(x), is applied to the original value (x) in the selected fields.</bullet_item><para/>
        ///     <bullet_item>Box-Cox—The Box-Cox power function is applied to normally distribute the original values in the selected fields. This is the default.</bullet_item><para/>
        ///     <bullet_item>Inverse Box-Cox—The inverse of the Box-Cox transformation is applied to the original values in the selected fields.</bullet_item><para/>
        ///     <bullet_item>Square (inverse square root)—The square method is applied to the original values in the selected fields. This transformation is the inverse of square root.</bullet_item><para/>
        ///     <bullet_item>Exponential (inverse log)—The exponential function, exp(x), is applied to the original value (x) in the selected fields. This transformation is the inverse of log.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于转换指定字段中包含的值的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>乘法逆—乘法逆 （1/x） 方法应用于所选字段中的原始值 （x）。</bullet_item><para/>
        ///     <bullet_item>平方根 - 平方根法应用于所选字段中的原始值。</bullet_item><para/>
        ///     <bullet_item>日志 - 自然对数函数 log（x） 应用于所选字段中的原始值 （x）。</bullet_item><para/>
        ///     <bullet_item>Box-Cox—应用 Box-Cox 幂函数以正态分布所选字段中的原始值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>Inverse Box-Cox—Box-Cox 变换的逆将应用于所选字段中的原始值。</bullet_item><para/>
        ///     <bullet_item>平方（平方根反比）- 将平方方法应用于所选字段中的原始值。此变换是平方根的倒数。</bullet_item><para/>
        ///     <bullet_item>指数（反向对数）—指数函数 exp（x） 应用于所选字段中的原始值 （x）。此转换是对数的逆转换。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Transformation Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _method_value _method { get; set; } = _method_value.value3;

        public enum _method_value
        {
            /// <summary>
            /// <para>Multiplicative Inverse</para>
            /// <para>Multiplicative Inverse—The multiplicative inverse (1/x) method is applied to the original value (x) in the selected fields.</para>
            /// <para>乘法逆—乘法逆 （1/x） 方法应用于所选字段中的原始值 （x）。</para>
            /// </summary>
            [Description("Multiplicative Inverse")]
            [GPEnumValue("INVX")]
            _INVX,

            /// <summary>
            /// <para>Square root</para>
            /// <para>Square root—The square root method is applied to the original value in the selected fields.</para>
            /// <para>平方根 - 平方根法应用于所选字段中的原始值。</para>
            /// </summary>
            [Description("Square root")]
            [GPEnumValue("SQRT")]
            _SQRT,

            /// <summary>
            /// <para>Log</para>
            /// <para>Log—The natural logarithmic function, log(x), is applied to the original value (x) in the selected fields.</para>
            /// <para>日志 - 自然对数函数 log（x） 应用于所选字段中的原始值 （x）。</para>
            /// </summary>
            [Description("Log")]
            [GPEnumValue("LOG")]
            _LOG,

            /// <summary>
            /// <para>Box-Cox</para>
            /// <para>Box-Cox—The Box-Cox power function is applied to normally distribute the original values in the selected fields. This is the default.</para>
            /// <para>Box-Cox—应用 Box-Cox 幂函数以正态分布所选字段中的原始值。这是默认设置。</para>
            /// </summary>
            [Description("Box-Cox")]
            [GPEnumValue("BOX-COX")]
            value3,

            /// <summary>
            /// <para>Square (inverse square root)</para>
            /// <para>Square (inverse square root)—The square method is applied to the original values in the selected fields. This transformation is the inverse of square root.</para>
            /// <para>平方（平方根反比）- 将平方方法应用于所选字段中的原始值。此变换是平方根的倒数。</para>
            /// </summary>
            [Description("Square (inverse square root)")]
            [GPEnumValue("INV_SQRT")]
            _INV_SQRT,

            /// <summary>
            /// <para>Exponential (inverse log)</para>
            /// <para>Exponential (inverse log)—The exponential function, exp(x), is applied to the original value (x) in the selected fields. This transformation is the inverse of log.</para>
            /// <para>指数（反向对数）—指数函数 exp（x） 应用于所选字段中的原始值 （x）。此转换是对数的逆转换。</para>
            /// </summary>
            [Description("Exponential (inverse log)")]
            [GPEnumValue("INV_LOG")]
            _INV_LOG,

            /// <summary>
            /// <para>Inverse Box-Cox</para>
            /// <para>Inverse Box-Cox—The inverse of the Box-Cox transformation is applied to the original values in the selected fields.</para>
            /// <para>Inverse Box-Cox—Box-Cox 变换的逆将应用于所选字段中的原始值。</para>
            /// </summary>
            [Description("Inverse Box-Cox")]
            [GPEnumValue("INV_BOX-COX")]
            value6,

        }

        /// <summary>
        /// <para>Power</para>
        /// <para>The power parameter ( λ1) of the Box-Cox transformation. If no value is provided, an optimal value is determined using maximum likelihood estimation (MLE).</para>
        /// <para>Box-Cox 变换的幂参数 （λ1）。如果未提供任何值，则使用最大似然估计 （MLE） 确定最佳值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Power")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _power { get; set; } = null;


        /// <summary>
        /// <para>Shift</para>
        /// <para><xdoc>
        ///   <para>The value by which all the data is shifted (adding a constant value). No shift is applied if 0 is specified.</para>
        ///   <para>For log, Box-Cox and square root transformations, a default shift value is added prior to the transformation if there are negative or zero values.</para>
        ///   <para>For exponential (inverse log), inverse Box-Cox, and square (inverse square root) transformations, no shift is applied by default. If a shift value is provided, the value is subtracted after the transformation is applied. This allows you to use the same shift value for transformations and their associated inverses.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>所有数据所依据的值（添加常量值）。如果指定了 0，则不应用移位。</para>
        ///   <para>对于对数变换、Box-Cox 变换和平方根变换，如果存在负值或零值，则在变换之前添加默认移位值。</para>
        ///   <para>对于指数（逆对数）、逆 Box-Cox 和平方（平方反比根）变换，默认情况下不应用任何移位。如果提供了移位值，则在应用转换后减去该值。这允许您对变换及其关联的逆变换使用相同的移位值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Shift")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _shift { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _updated_table { get; set; }


        public TransformField SetEnv(object extent = null)
        {
            base.SetEnv(extent: extent);
            return this;
        }

    }

}